package br.com.infnet.formularioeletronico.modelo;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@Table(name = "responde")
public class Responde implements Serializable {

    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected RespondePK respondePK;
    @Column(name = "valor")
    private Integer valor;
    @JoinColumn(name = "id_questao", referencedColumnName = "id_questao", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Questao questao;
    @JoinColumn(name = "id_avaliacao", referencedColumnName = "id_avaliacao", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Avaliacao avaliacao;
    @JoinColumn(name = "id_aluno", referencedColumnName = "id_aluno", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Aluno aluno;

    public RespondePK getRespondePK() {
        return respondePK;
    }

    public void setRespondePK(RespondePK respondePK) {
        this.respondePK = respondePK;
    }

    public Integer getValor() {
        return valor;
    }

    public void setValor(Integer valor) {
        this.valor = valor;
    }

    public Questao getQuestao() {
        return questao;
    }

    public void setQuestao(Questao questao) {
        this.questao = questao;
    }

    public Avaliacao getAvaliacao() {
        return avaliacao;
    }

    public void setAvaliacao(Avaliacao avaliacao) {
        this.avaliacao = avaliacao;
    }

    public Aluno getAluno() {
        return aluno;
    }

    public void setAluno(Aluno aluno) {
        this.aluno = aluno;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (respondePK != null ? respondePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Responde)) {
            return false;
        }
        Responde other = (Responde) object;
        if ((this.respondePK == null && other.respondePK != null) || (this.respondePK != null && !this.respondePK.equals(other.respondePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.infnet.formularioeletronico.modelo.Responde[ respondePK=" + respondePK + " ]";
    }
}
